<template>
  <el-row>
    <el-col :span="12">
      <el-tooltip
        content="查询发票状态"
        placement="bottom-start"
        effect="light"
      >
        <i
          class="el-icon-search"
          @click="queryElectricKp"
          :style="{ display: buttonVisible }"
        ></i>
      </el-tooltip>
    </el-col>
    <el-col :span="12">
      <el-tooltip content="推送发票" placement="bottom-start" effect="light">
        <i
          class="el-icon-message"
          @click="sendInvocie"
          :style="{ display: enableSendMail }"
        ></i>
      </el-tooltip>
    </el-col>
  </el-row>
</template>
<script>
import { ajax } from "@/store/yg/common/utils";
import { m } from "@/store/yg/common/local";
export default {
  props: ["row", "data", "more"],
  data() {
    return {
      buttonVisible: "none",
      enableSendMail: "none"
    };
  },
  mounted() {
    console.log(this.data);
    let status = this.data.status;
    // if (status === "20" || status === "21" || status === "24") {
      this.buttonVisible = "";
    // }
    let buyerReceiveEmail = this.data.buyerReceiveEmail;
    // alert(buyerReceiveEmail);
    if (buyerReceiveEmail) {
      this.enableSendMail = "";
    }
  },
  methods: {
    m(k) {
      return m(k);
    },
    queryElectricKp() {
      ajax("queryElectricKp", { orderno: this.data.orderno }).then(res => {
        if (res.code == 200) {
          this.$message.success(m(res.message));
        } else {
          this.$message.error(m(res.message));
        }
      });
    },
    sendInvocie() {
      ajax("sendInvocie", { id: this.data.id }).then(res => {
        if (res.success) {
          this.$message.success("发送成功");
        } else {
          this.$message.error(m(res.message));
        }
      });
    }
  }
};
</script>
